import cv2
img = cv2.imread('dog.jpg')
b, g, r = cv2.split(img)  # 拆分
img = cv2.merge((b, g, r))  # 合并
cv2.imshow('dog1', img)
cv2.waitKey(0)
b = img[:, :, 0]
g = img[:, :, 1]
r = img[:, :, 2]
img = cv2.merge((b, g, r))  # 合并
img[:, :, 2] = 0  # 将r红色通道所有像素值置0
cv2.imshow('dog2', img)
cv2.waitKey(0)
cv2.destroyAllWindows()